﻿<UserControl x:Class="OSBIDE.Controls.Views.AssignmentSubmissions"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:views="clr-namespace:OSBIDE.Controls.Views"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="38" />
            <RowDefinition Height="228*" />
            <RowDefinition Height="40" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        
        <!-- Row 1 -->
        <StackPanel Grid.Row="0" Orientation="Vertical" >
            <TextBlock Text="Assignment:" />
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="50" />
                </Grid.ColumnDefinitions>
                <ComboBox Grid.Column="0" ItemsSource="{Binding Path=AvailableAssignments}" SelectedValue="{Binding Path=SelectedAssignment, Mode=TwoWay}" />
                <Button Grid.Column="1" Command="{Binding Path=RefreshAssignments}" Content="Refresh" />
            </Grid>
        </StackPanel>
        
        <!-- Row 2 -->
        <ListBox Grid.Row="1" ItemsSource="{Binding Path=SubmissionEntries, Mode=TwoWay}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <views:SubmissionEntry />
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        
        <!-- Row 3-->
        <StackPanel Grid.Row="2" Orientation="Vertical">
            <TextBlock x:Name="ErrorMessage" Foreground="Red" Text="{Binding Path=ErrorMessage, Mode=OneWay}" />
            <Button Grid.Row="2" Content="Download All" Command="{Binding Path=DownloadCommand}" />
        </StackPanel>
        
    </Grid>
</UserControl>
